package com.luo.touchevent;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.FrameLayout;

/**
 * Created by Administrator on 2017/2/12.
 */

public class OutFrameLayout extends FrameLayout {
    public OutFrameLayout(Context context) {
        super(context);
    }

    public OutFrameLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public OutFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        switch (ev.getAction()){
            case MotionEvent.ACTION_DOWN:
                System.out.println("OutFrameLayout--------dispatchTouchEvent  DOWN");
                break;
            case MotionEvent.ACTION_MOVE:
                System.out.println("OutFrameLayout--------dispatchTouchEvent  MOVE");
                break;
            case MotionEvent.ACTION_UP:
                System.out.println("OutFrameLayout--------dispatchTouchEvent  UP");
                break;
        }
        return true;
//        return super.dispatchTouchEvent(ev);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        switch (ev.getAction()){
            case MotionEvent.ACTION_DOWN:
                System.out.println("OutFrameLayout--------onInterceptTouchEvent  DOWN");
                break;
            case MotionEvent.ACTION_MOVE:
                System.out.println("OutFrameLayout--------onInterceptTouchEvent  MOVE");
                break;
            case MotionEvent.ACTION_UP:
                System.out.println("OutFrameLayout--------onInterceptTouchEvent  UP");
                break;
        }
//        return true;
        return super.onInterceptTouchEvent(ev);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        switch (event.getAction()){
            case MotionEvent.ACTION_DOWN:
                System.out.println("OutFrameLayout--------onTouchEvent  DOWN");
                break;
            case MotionEvent.ACTION_MOVE:
                System.out.println("OutFrameLayout--------onTouchEvent  MOVE");
                break;
            case MotionEvent.ACTION_UP:
                System.out.println("OutFrameLayout--------onTouchEvent  UP");
                break;
        }
        return super.onTouchEvent(event);
    }
}
